package com.net.xpay.sync.client.handler;

import com.net.xpay.core.helper.EnvironmentHelper;
import com.net.xpay.sync.client.AbstractSyncEventHandler;
import com.net.xpay.sync.client.SyncEventHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 2020/9/1 17:49

 */
@Slf4j
@Component
public class PoseidonUserWithdrawRecordHandler extends AbstractSyncEventHandler implements SyncEventHandler {

    @Autowired
    private EnvironmentHelper environmentHelper;

    /**
     * @return 订阅的库表正则
     */
    @Override
    public String getSubscribeRegex() {
        if (environmentHelper.isProd()) {
            return "xpay_prod_\\d+\\.user_withdraw_record";
        }
        return "xpay_dev_\\d+\\.user_withdraw_record";
    }

    /**
     * @return 目标表的表前缀 可为空
     */
    @Override
    public String tablePrefix() {
        return "common_";
    }
}
